import javax.swing.Icon;
import javax.swing.JButton;

/**
 * 方格类以及移动方法
 */

/**
 * @author sdvina
 * 
 */
@SuppressWarnings("serial")
public class Cell extends JButton {
	Cell(Icon icon) {
		super(icon);
		this.setSize(100, 100);
	}

	public void move(String direction, int distance) {
		if (direction == "UP") {
			this.setLocation(this.getBounds().x, this.getBounds().y - distance);
		} else if (direction == "DOWN") {
			this.setLocation(this.getBounds().x, this.getBounds().y + distance);
		} else if (direction == "LEFT") {
			this.setLocation(this.getBounds().x - distance, this.getBounds().y);
		} else {
			this.setLocation(this.getBounds().x + distance, this.getBounds().y);
		}

	}

}
